Matlab三维法线箭头图绘制函数quiver3 您所在的位置:网站首页 matlab quiver箭头大小 Matlab三维法线箭头图绘制函数quiver3

Matlab三维法线箭头图绘制函数quiver3

2023-10-12 08:31| 来源: 网络整理| 查看: 265

今天,开始讲解关于Matlab中绘制三维箭头速度矢量图的方法。Matlab提供了一个quiver3函数,可以很轻松的将坐标点用箭头表示,很直观的表示其中的物理规律。本文主要讲解Matlab中quiver3函数的常见用法,语法说明,创建三维箭头图,以及曲面图法线的绘制等。

Matlab三维法线箭头图绘制函数quiver3

下面,我们首先给出Matlab中关于quiver3函数的帮助文档如下:

>> help quiver3 quiver3 3-D quiver plot. quiver3(X,Y,Z,U,V,W) plots velocity vectors as arrows with components (u,v,w) at the points (x,y,z). The matrices X,Y,Z,U,V,W must all be the same size and contain the corresponding position and velocity components. quiver3 automatically scales the arrows to fit. quiver3(Z,U,V,W) plots velocity vectors at the equally spaced surface points specified by the matrix Z. quiver3(Z,U,V,W,S) or quiver3(X,Y,Z,U,V,W,S) automatically scales the arrows to fit and then stretches them by S. Use S=0 to plot the arrows without the automatic scaling. quiver3(...,LINESPEC) uses the plot linestyle specified for the velocity vectors. Any marker in LINESPEC is drawn at the base instead of an arrow on the tip. Use a marker of '.' to specify no marker at all. See PLOT for other possibilities. quiver3(...,'filled') fills any markers specified. quiver3(AX,...) plots into AX instead of GCA. H = quiver3(...) returns a quiver object. Example: [x,y] = meshgrid(-2:.2:2,-1:.15:1); z = x .* exp(-x.^2 - y.^2); [u,v,w] = surfnorm(x,y,z); quiver3(x,y,z,u,v,w); hold on, surf(x,y,z), hold off常见用法quiver3(x,y,z,u,v,w) quiver3(z,u,v,w) quiver3(...,scale) quiver3(...,LineSpec) quiver3(...,LineSpec,'filled') quiver3(...,'PropertyName',PropertyValue,...) quiver3(ax,...) h = quiver3(...)语法说明

三维箭头图显示分量 (u,v,w) 位于点 (x,y,z) 处的向量,其中,u、v、w、x、y 和 z 都有实数(非复数)值。

quiver3(x,y,z,u,v,w) 在 (x,y,z) 确定的点处绘制向量,其方向由分量 (u,v,w) 确定。矩阵 x、y、z、u、v 和 w 必须具有相同大小并包含对应的位置和向量分量。

quiver3(z,u,v,w) 在沿曲面 z 的等间距点处绘制向量,其方向由分量 (u,v,w) 确定。对于每个向量 (u(i,j),v(i,j),w(i,j)),列索引 j 确定曲面上点的 x 值,i 确定 y 值,z(i,j) 确定 z 值。即,quiver3 将向量定位在曲面上的点 (j,i,z(i,j)) 处。quiver3 函数基于向量之间的距离自动缩放向量以避免它们重叠在一起。

quiver3(…,scale) 自动缩放向量以避免它们重叠在一起,然后将向量乘以 scale。scale = 2 使它们的相对长度加倍,而 scale = 0.5 使它们的相对长度减半。使用 scale = 0 绘制向量,无需自动缩放。

quiver3(…,LineSpec) 使用任何有效的 LineSpec 指定线型、标记符号和颜色。quiver3 在向量原点处绘制标记。

quiver3(…,LineSpec,’filled’) 填充 LineSpec 指定的标记。

quiver3(…,’PropertyName’,PropertyValue,…) 为该函数创建的箭头图指定属性名称和属性值对组。

quiver3(ax,…) 将图形绘制到 ax 坐标区中,而不是当前坐标区 (gca) 中。

h = quiver3(…) 返回 Quiver 对象。

创建三维箭头图

定义该数据。

x = -3:0.5:3; y = -3:0.5:3; [X,Y] = meshgrid(x, y); Z = Y.^2 - X.^2; [U,V,W] = surfnorm(Z);

绘制向量,其中包含在 x 方向和 y 方向上等间距的点处的分量 (U,V,W),并且具有由 Z 确定的高度。

figure quiver3(Z,U,V,W) view(-35,45)

Matlab三维法线箭头图绘制函数quiver3绘制曲面图法线

绘制函数 z=xe−x^2−y^2 的曲面图法线。

[X,Y] = meshgrid(-2:0.25:2,-1:0.2:1); Z = X.* exp(-X.^2 - Y.^2); [U,V,W] = surfnorm(X,Y,Z); figure quiver3(X,Y,Z,U,V,W,0.5) hold on surf(X,Y,Z) view(-35,45) axis([-2 2 -1 1 -.6 .6]) hold off

Matlab三维法线箭头图绘制函数quiver3

共计6人评分,平均4.7分

到目前为止还没有投票~

很抱歉,这篇文章对您没有用!

让我们改善这篇文章!

告诉我们我们如何改善这篇文章?

文章目录

常见用法语法说明创建三维箭头图绘制曲面图法线

原创文章,作者:古哥钻石会员,转载需经过作者授权同意,并附上原文链接:https://iymark.com/articles/1553.html



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有